-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes handling of numeric strings in span tag values #436
Fixes handling of numeric strings in span tag values #436
Conversation
adb8dcf
to
8b7b0f8
Compare
Codecov Report
@@ Coverage Diff @@
## master #436 +/- ##
==========================================
- Coverage 90.98% 90.94% -0.05%
==========================================
Files 177 177
Lines 4106 4108 +2
Branches 991 992 +1
==========================================
Hits 3736 3736
- Misses 327 329 +2
Partials 43 43
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. I think the check could be folded into parseIfJson
, i.e. parseIfComplexJson
, but this works, too.
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx
Outdated
Show resolved
Hide resolved
57abda4
to
066ed83
Compare
Signed-off-by: Matus Majchrak <[email protected]>
19430b0
to
510f77e
Compare
Signed-off-by: Matus Majchrak <[email protected]>
alright, could you, please, give it one more try? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes. A couple of small questions...
|
||
function parseIfComplexJson(value: any) { | ||
// if the value is a string representing actual json object or array, then use json-markup | ||
if (typeof value === 'string' && value.match(jsonObjectOrArrayStartRegex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be jsonObjectOrArrayStartRegex.test(value)
to avoid generating match data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right
if (typeof value === 'string' && value.match(jsonObjectOrArrayStartRegex)) { | ||
// otherwise just return as is | ||
try { | ||
console.log('parsing JSON'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this log statement a left-over?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, fixed now
Signed-off-by: Matus Majchrak <[email protected]>
1c038e6
to
4b61e23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
🎉 Thanks for contributing!! 🎉 |
Pleasure is all mine, well setup project and great feedback. |
Fixes handling of numeric strings in span tag values Signed-off-by: vvvprabhakar <[email protected]>
Signed-off-by: Matus Majchrak [email protected]
Fixes the rendering of span tag values that contain numeric strings
Hi this is my first PR to this project so bear with me :)
Resolves #396
Which problem is this PR solving?
As stated in bug #396, span tags containing numeric strings will be converted to actual numbers and rendered in scientific notation if they are large enough.
Short description of the changes
As hinted by @tiffon, this commit limits the json conversion of tag values only to cases, when the value is an actual string and is not a primitive type(i.e. only if it is object or array)
The one open point from my side, is what would be a meaningful test for the rendering of tag value containing real json object(if it is required) as I had some trouble creating an elegant test case that would verify the
dangerouslySetInnerHTML
contents(right now I verify it by call tohtml()
and then string matching...) and what role should tagtype
attribute play in the rendering:e.g.
given span tag payload:
Not sure if this is a valid case.
In any case, looking forward to your feedback.